package cn.ljx.service.Impl;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.ljx.dao.UserDao;
import cn.ljx.entity.TBUser;
import cn.ljx.service.TBUserService;

@Service
public class TBUserServiceImpl implements TBUserService{
	
    @Autowired
	private UserDao userDao;

	//验证登录
	public TBUser checkLogin(String username, String password) {
	    //判断用户是否存在
		TBUser tbuser = userDao.getUserByName(username);
	    if (tbuser != null && tbuser.getPassword().equals(password)) {
	        return tbuser;
	    }
	    return null;
	}
	

	public int delectUser(String login_name) {
		return userDao.deleteUser(login_name);
	}

	public int addUser(TBUser tbuser) {
		return userDao.addUser(tbuser);
	}

	public TBUser getUserByName(String username) {
		// TODO Auto-generated method stub
		return userDao.getUserByName(username);
	}

	public TBUser getUserById(String id) {
		// TODO Auto-generated method stub
		return userDao.getUserById(id);
	}

	public int updateUser(TBUser tbuser) {
		// TODO Auto-generated method stub
		return userDao.updateUser(tbuser);
	}

	public List<TBUser> gettbUserList(String real_name) {
		// TODO Auto-generated method stub
		return userDao.gettbUserList(real_name);
	}
}
